package com.lirh.mysql.controller;

import com.lirh.mysql.entity.Reply;
import com.lirh.mysql.service.ReplyServiceImpl;
import com.lirh.mysql.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/reply")
public class ReplyController {
    @Autowired
    private ReplyServiceImpl replyService;

    @GetMapping("/all/{id}")
    public R getall(@PathVariable("id") Integer id){
        List<Reply> getallreply = replyService.getallreply(id);
        return R.ok().put("data",getallreply);
    }
    @PostMapping("/insert")
    public R insert(@RequestBody Reply reply){
        String res = replyService.insert(reply);
        return R.ok().put("data",res);
    }

}
